<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>添加记录</title>
		<link rel="stylesheet" type="text/css" href="../css/Reimbursement.css" />
		<script type="text/javascript" src="../js/jquery.min.js" charset="utf-8"></script>
		<script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
		<meta name="viewport" content=" height=device-height,
			          width=device-width,
			          initial-scale=1.0,
			          minimum-scale=1.0,
			          maximum-scale=1.0,
			          user-scalable=no" />
		<script type="text/javascript">
			$(function() {
				var carNum = localStorage.getItem("carNum");
				var carName = localStorage.getItem("carName");
				document.getElementById('carNum').value = carNum;
				document.getElementById('carName').value = carName;
				
			})
			function add() {
				var ip = localStorage.getItem("ip");
				var token = localStorage.getItem("token");
				var userId = localStorage.getItem("userId");
				var carId = localStorage.getItem("carId");
				var url = ip + "car/oil";
				var formData = new FormData($('#dataForm')[0]);
				formData.append("createId", userId);
				formData.append("carId", carId);
				formData.append("token", token);
				$.ajax({
					cache: false,
					type: "POST",
					url: url,
					data: formData,
					processData: false,
					contentType: false,
					error: function(request) {},
					success: function(data) {
						var a = JSON.parse(data)
						alert(a.msg);
						if("成功" == a.msg) {
							window.location.href = 'vehicleManageList.html';
						}
					}
				});
			}
		</script>
	</head>

	<body style="background: #d9d9d9;">
		<form action="#" method="post" id="dataForm" enctype="multipart/form-data">
			<div style=" background: white; width: 90%; margin-left: 5%;margin-top: 10%; box-shadow:1px 2px 1px 1px #aaa;-webkit-border-radius: 10px;">
				<label></label><br />
				<label></label><br />
				<label>选择管理:</label>
				<select id="scrap" class="txt" name="type">
					<option value="1">加油</option>
					<option value="2">保养</option>
				</select><br />
				<label>车&nbsp;&nbsp;牌&nbsp;&nbsp;号:</label>
				<input type="text" id="carNum" class="txt" /><br />
				<label>车辆名称:</label>
				<input type="text" id="carName" class="txt"/><br />
				<label>描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述:</label>
				<input type="text" id="describe" class="txt" name="describe" /><br />
				<label>金&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;额:</label>
				<input type="text" id="money" class="txt" name="money" /><br />
				<label>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;点:</label>
				<input type="text" id="place" class="txt" name="place" /><br />
				<label>付费方式:</label>
				<select id="scrap" class="txt" name="payMethod">
					<option value="1">卡</option>
					<option value="0">现金</option>
				</select><br /><br />
				<label for="hobbies" class="label_title">上传照片:</label>
				<input style="margin-left: 3%;" type="file" id="myfiles" name="myfiles" multiple="multiple" /><br />
				<input type="button" onclick="add()" value="添加并报销" class="txt" style=" font-weight:bold; font-size: calc(15vw/3.75); color: white; height: 40px; margin-left: 15%;margin-top: 25%;background: #33ff99;" /><br />
				<label></label><br />
				<label></label><br />
				<label></label><br />
			</div>
		</form>
	</body>

</html>